package com.czk.writer;

import java.lang.reflect.Field;

/**
 * 测试生成的类
 *
 * @Author:ChenZhangKun
 * @Date: 2021/9/13 23:13
 */
public class Test {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        // Class<?> clazz = Class.forName("com.czk.sample.Czk");
        // 第一次主动使用，会触发static静态代码块
        Class<?> clazz = Class.forName("com.czk.sample.GenerateCinit");
        Object o = clazz.newInstance();
        System.out.println(clazz);
        Field[] declaredFields = clazz.getDeclaredFields();
        for (Field field : declaredFields) {
            Object o1 = field.get(o);
            System.out.println(o1);
        }
    }
}
